vr2-6-03.wrl
[ VRML source code ]
#VRML V2.0 utf8
#vr2-6-03.wrl
Group {
children [
DEF LampTouch TouchSensor {}
Transform {
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 1 1 0
}
}
geometry Box {
size 100 10 100
}
}
Transform {
translation 0 50 0
children Shape {
appearance Appearance {
material DEF LampColor Material {
diffuseColor 0.2 0.2 0.2
}
}
geometry Sphere { radius 40 }
}
}
Transform {
translation 0 10 0
children Shape {
appearance Appearance {
material Material {
diffuseColor 0 1 0
}
}
geometry Cylinder {
radius 20
height 10
}
}
}
Transform {
translation 0 100 0
children Shape {
appearance Appearance {
material Material {
diffuseColor 0 1 0
transparency 0.5
}
}
geometry Cone {
bottomRadius 70
height 90
bottom FALSE
}
}
}
]
}
DEF LampSwitch Script {
eventIn SFBool isActive
eventOut SFColor color
field SFColor OnColor 1 1 0
field SFColor OffColor 0.2 0.2 0
url "javascript:
function isActive(b, eT) {
if (b==true) color=OnColor;
else color=OffColor;
}"
}
]
}
ROUTE LampTouch.isActive TO LampSwitch.isActive
ROUTE LampSwitch.color TO LampColor.set_diffuseColor